package com.ATM;

import java.util.Scanner;


public class AtmManager {

    public void run() {
        //用户信息初始化
        User user = new User();
        user.setUserID("root");
        user.setPassWord("123456");
        user.setMoney(200000000);

        //Scanner初始化
        Scanner scanner =new Scanner(System.in);

        //新建atm变量
        ATM atm = new ATM();

        //新建一个boolean类型变量login
        boolean login = atm.login(user,scanner);

        //执行
        while (login){
            System.out.println("-----------欢迎使用本ATM机-----------");
            System.out.println("请选择功能：");
            System.out.println("1.查看余额");
            System.out.println("2.存款");
            System.out.println("3.取款");
            System.out.println("4.更改密码");
            System.out.println("5.退卡");
            System.out.println("请选在您所需要办理的业务：");
            int  choice = scanner.nextInt();

            switch (choice){
                case 1:
                    atm.show(user);
                    break;
                case 2:
                    atm.deposit(user,scanner);
                    break;
                case 3:
                    atm.withdrawal(user,scanner);
                    break;
                case 4:
                    atm.changePassword(user,scanner);
                    break;
                case 5:
                    login = false;
                    atm.exit();
                    break;
            }


        }

    }

}
